package com.hspedu.static_.main_;

public class SingleTon {
    public static void main(String[] args) {
        GirlFriend instance = GirlFriend.getInstance();
        System.out.println(instance);
        GirlFriend instance2 = GirlFriend.getInstance();
        System.out.println(instance2);
    }
}

class GirlFriend{
    private String name;
    private static GirlFriend girl = new GirlFriend("merry");
    private GirlFriend(String name) {
        this.name = name;
    }

    public static GirlFriend getInstance(){
        return girl;
    }
}